﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.TPYRS
{
    class Class2
    {

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故") || ppa.SchemePeriodActing.InsurantStates.Contains("全残"))
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重大手术"))
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("特定疾病"))
            {
                double a1 = ppa.GetDutyTotalValue("特定疾病关爱提前给付");

                double a4 = ppa.Amount - a1;

                if (a4 > double.Epsilon)
                {
                    double a2 = ppa.Amount * 0.3;
                    double a3 = a2 > 100000 ? 100000 : a2;

                    da.Value = a3 > a4 ? a4 : a3;
                }
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故") || ppa.SchemePeriodActing.InsurantStates.Contains("全残"))
            {
                if (ppa.Age < 18)
                {
                    da.Value =ppa.Amount * 0.5 + ppa.TotalFee;
                }
                else
                {
                    da.Value = ppa.Amount ;

                }
                ppa.IsCurrentFinish = true;
            }

        }
    }
}
